package com.demo.plan.testService;

import com.demo.plan.dao.UserMapper;
import com.demo.plan.entity.User;
import com.demo.plan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Scanner;

@Service
public class TuAnService{
    public static void fun() {
        // 打印图案
        for (int i = 0; i < 12; i++) {
            if (i == 0 || i == 6 || i == 11) {
                print(13, "*");
                changeLine();
                continue;
            }
            int firstPart = i<6?(i%6)-1:5-(i%6);
            int secondPart = 4 - firstPart;
            printRow(firstPart, secondPart);
        }
    }

    private static void printRow(int firstPart, int secondPart) {
        print(1, "*");
        print(firstPart, " ");
        print(1, "*");
        print(secondPart, " ");
        print(1, "*");
        print(secondPart, " ");
        print(1, "*");
        print(firstPart, " ");
        print(1, "*");
        changeLine();
    }

    private static void print(int n, String str) {
        for (int i = 0; i < n; i++) {
            System.out.print(str);
        }
    }

    private static void changeLine() {
        System.out.println();
    }
}
